$(function () {
    getRoom();
});

function getRoom() {
    let result = myAjax('/getRoom', 'get', {});
    data = result.list;
}

function setOrder() {
    let data = {
        username: $("#username").val(),
        phone: $("#phone").val(),
        inTime: $("#inTime").val(),
        outTime: $("#outTime").val(),
        roomType: $("input[name='roomType']:checked").val(),
        opinion: $("#opinion").val(),
    };
    let result = myAjax('/setOrder', 'post', data);
    data = result.count;
    if (data === 1) {
        alert("提交成功！")
        window.open('/html/reservation.html');
    } else {
        alert(" 提交失败！")
    }
}